<?php
/**
 * Get module list and config data
 *
 * @author     Mario Schillermann <info@rockit-flash.com>
 * @encoding   UTF-8 äöüßÖÄÜ
 * @copyright  © 2011 Mario Schillermann (info@rockit-flash.com)
 * @license    GNU GPL v2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @uses       App_Model_Module_Interface
 * @category   Library
 * @package    App
 * @subpackage Model
 * @todo
 */
abstract class App_Model_Module_Abstract implements App_Model_Module_Interface
{
    /**
     * Module list
     * 
     * @var array
     */
    protected $_modules = null;
    
    /**
     * Front controller
     * 
     * @var Zend_Controller_Front
     */
    protected $_frontController = null;

    /**
     * Get Modules from front controller
     * 
     * @return array Module list
     */
    public function getModules()
    {
        if ($this->_modules === null) {
            $this->setModules();
        }
        return $this->_modules;
    }
    
    /**
     * Get front controller
     * 
     * @return array Module list
     */
    public function getFrontController()
    {
        if ($this->_frontController === null) {
            $this->setFrontController();
        }
        return $this->_frontController;
    }
    
    /**
     * Set Modules from front controller
     * 
     * @return void
     */
    public function setModules()
    {
        $this->_modules = $this->getFrontController()->getControllerDirectory();
    }
    
    /**
     * Set front controller
     * 
     * @return void
     */
    public function setFrontController()
    {
        $this->_frontController = Zend_Controller_Front::getInstance();
    }
}